import { ClassFactory, DependencyFetcher } from "../interface/utils"

export default class SdkCommand {
  dependencies: any[]
  executor: any
  constructor(dependencies: any[], executor: ClassFactory) {
    this.dependencies = dependencies
    this.executor = executor.create()
  }
  static async create(e: DependencyFetcher, executor: ClassFactory) {
    const dependencies = await e.getDependencies()
    return new SdkCommand(dependencies, executor)
  }
  exec(e, t) {
    const o = this.executor.validateInput(e, ...this.dependencies)
    this.executor.exec(o, t, ...this.dependencies)
  }
}
